/*
 * ========================================================
 * Copyright(c) 2014 杭州龙骞科技-版权所有
 * ========================================================
 * 本软件由杭州龙骞科技所有, 未经书面许可, 任何单位和个人不得以
 * 任何形式复制代码的部分或全部, 并以任何形式传播。
 * 公司网址
 * 
 * 			http://www.hzdracom.com/
 * 
 * ========================================================
 */
package com.netease.nim.demo.session.model.extension;

import logic.bean.NewInteractionInfo;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

/**
 * @Project： qysw_1.0.8_dev
 * @Title：ActivityAttachment
 * @Description：
 * @Author：wayne
 * @Date：2015年5月25日上午11:02:08
 */
public class ActivityAttachment extends CustomAttachment
{

	private NewInteractionInfo info;
	
	public ActivityAttachment(NewInteractionInfo info) {
	    super(CustomAttachmentType.InteractionInfo);
	    this.info = info;
    }

	@Override
    protected void parseData(JSONObject data) {
		info = new Gson().fromJson(data.toString(), new TypeToken<NewInteractionInfo>(){}.getType());
    }

	@Override
    protected JSONObject packData() {
		JSONObject data = new JSONObject();
		
		data.put("authorHeaderImage", info.getAuthorHeaderImage());
		data.put("authorName", info.getAuthorName());
		data.put("commentNum", info.getCommentNum());
        data.put("content", info.getContent());
        data.put("id", info.getId());
        data.put("imageList", info.getImageList());
        data.put("publishTime", info.getPublishTime());
        data.put("autorRole", info.getAutorRole());
        return data;
    }

	/**
	 * @return the info
	 */
	public NewInteractionInfo getInfo() {
		return info;
	}

	/**
	 * @param info the info to set
	 */
	public void setInfo(NewInteractionInfo info) {
		this.info = info;
	}
	
	
	
}
